//创建一个路由器，并暴露出去
//引入createRouter
import { createRouter,createWebHistory } from "vue-router";

//引入组件
import Home from '@/pages/Home.vue'
import News from '@/pages/News.vue'
import About from '@/pages/About.vue'
import Detail from '@/pages/Detail.vue'

//创建路由器
const router=createRouter({
    history:createWebHistory(),//路由器的工作模式
    routes:[
      {
        path:'/home',
        component:Home
      },
      {
        path:'/news',
        component:News,
        children:[
          {
            path:'detail',
            component:Detail
          }
        ]
      },
      {
        path:'/about',
        component:About
      }
    ]
})

export default router